package com.zhanggm.springcloud.jpa.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

import javax.persistence.*;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @author zhanggm
 * null
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@Entity
@Table(name = "tb_doctor")
@DynamicInsert
@DynamicUpdate
@ApiModel("医生实体类")
public class TbDoctor implements Serializable {

	/**
	 * null
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id")
	private Integer id;

	/**
	 * null
	 */
	@ApiModelProperty("医生姓名")
	@Column(name = "name")
	private String name;

	/**
	 * 枚举
	 */
	@Column(name = "gender")
	private Integer gender;

	/**
	 * null
	 */
	@Column(name = "depart_id")
	private Integer departId;

	@Transient
	private String departName;

	/*@OneToOne
	@JoinColumn(name = "depart_id",referencedColumnName = "id",updatable = false,insertable = false)
	private TbDepart tbDepart;*/

	@JsonIgnoreProperties("doctors")
	@ManyToOne/*(fetch = FetchType.EAGER)*/
	@JoinColumn(name = "depart_id",insertable = false,updatable = false)
	private TbDepart tbDepart;


	/**
	 * null
	 */
	@Column(name = "birthday")
	private java.sql.Date birthday;

	/**
	 * null
	 */
	@Column(name = "head_image")
	private String headImage;

	/**
	 * null
	 */
	@Column(name = "sheng_id")
	private Integer shengId;

	@ManyToOne/*(fetch = FetchType.EAGER)*/
	@JoinColumn(name = "sheng_id",insertable = false,updatable = false)
	private TbArea sheng;

	@Transient
	private String shengName;

	/**
	 * null
	 */
	@Column(name = "shi_id")
	private Integer shiId;

	@ManyToOne/*(fetch = FetchType.EAGER)*/
	@JoinColumn(name = "shi_id",insertable = false,updatable = false)
	private TbArea shi;

	@Transient
	private String shiName;

	/**
	 * null
	 */
	@Column(name = "xian_id")
	private Integer xianId;

	@ManyToOne/*(fetch = FetchType.EAGER)*/
	@JoinColumn(name = "xian_id",insertable = false,updatable = false)
	private TbArea xian;

	@Transient
	private String xianName;

	@Transient
	private String skillName;


	@ManyToMany
	@JoinTable(name = "tb_doc_skill", joinColumns = @JoinColumn(name = "doc_id"),inverseJoinColumns = @JoinColumn(name = "skill_id"))
	private List<TbSkill> skills;

	@Transient
	private List<Integer> skillIds;

	@Transient
	private List<Integer> ids;

	@Transient
	private String usernmae;

	@Column(name = "user_id")
	private Integer userId;

	@Transient
	private String userName;

}
